﻿using SCG.General;
using System;
using System.Net;

namespace SCG.SolarVengeanceEngine.StarShips
{
    //CommandShips
    public class CommandShip : StarShip
    {
        //constructor
        public CommandShip(SVGame game, Player owner, int engines, int commandRange, StarSystem origin)
            : base(game, owner, engines, commandRange, origin)
        {
        }

        //Name
        public override string Name
        {
            get
            {
                return "CommandShip";
            }
        }

        //description
        public override string Description
        {
            get
            {
                return "CommandShips exert a \"command influence\" over an area determined by their Command Range.  WarShips within the Command Range have their effective Weapons rating increased by 1.  Multiple CommandShips can produce a cumulative effect.";
            }
        }

        //ship type
        public override StarShipType ShipType
        {
            get
            {
                return StarShipType.CommandShip;
            }
        }

        //exert command influence
        protected internal override void CommonPreProcessing()
        {
            foreach(StarShip ship in Owner.StarShips)
                if (ship is WarShip)
                    if (Distance(ship) <= Value)
                    {
                        WarShip warShip = ship as WarShip;
                        warShip.CommandInfluence++;
                    }
        }

        //show command range
        public override SCGColor RadiusColor
        {
            get
            {
                return CommandRangeColor;
            }
        }

        //private members
        private static SCGColor CommandRangeColor = new SCGColor(96, 255, 255, 0);
    }
}
